[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
do do-while Statement
do
statement
while (expression);
The do-while statement executes the statements in the body, and then
evaluates the looping criteria at the end of the loop. If the
expression is true, the loop is re-entered and the body is executed
again. When the expression tests false control is passed to the next
statement following the loop.
Notes: With the do-while construct, the statements in the body
are always executed at least once. That's because the
condition is tested at the end of the loop, rather than
at the beginning--as in the `for' and `while' statements.
You can terminate a do statement prematurely by using a
goto, return, or break statement. The continue statement
terminates only the current iteration of the loop.
-------------------------------- Example ---------------------------------
do { /* Use braces for multiple statements */
process();
i++;
} while (i < 20);
See Also:
while
continue
break
goto
return
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson